package com.wwh.JDBC;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * @author Albert
 * @date 2024/8/29-10:18
 * @describe
 */
@Repository
public class MonsterDAO {
    @Resource
    private JdbcTemplate jdbcTemplate;

    public void save(Monster monster){
        String sql = "INSERT INTO monster VALUES (?, ?, ?)";
        int update = jdbcTemplate.update(sql, monster.getMonsterId(), monster.getName(), monster.getSkill());
        System.out.println("受影响行数 = " + update);
    }
}
